#include "simple_factory.h"

#include <iostream>

AbstractFactory::AbstractFactory()
{}

AbstractFactory::~AbstractFactory()
{}

SimpleFactory::SimpleFactory()
{
	std::cout << "create SimpleFactory instance" << std::endl;
}

SimpleFactory::~SimpleFactory()
{
	std::cout << "release SimpleFactory instance" << std::endl;
}

AbstractProduct* SimpleFactory::CreateProduct(AbstractProduct::Type type)
{
	AbstractProduct* product = NULL;
	switch(type)
	{
		case AbstractProduct::TYPE_A:
		{
			product = new ProductA();
			break;
		}
		case AbstractProduct::TYPE_B:
		{
			product = new ProductB();
			break;
		}
		default:
			std::cout << "Error product type: " << type << std::endl;
			break;
	}
	return product;
}